<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<!DOCTYPE html>
<html class="x-admin-sm">
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	request.setAttribute("basePath", basePath);
%>
<head>
<meta charset="UTF-8">
<title>仓库管理</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
<link rel="stylesheet" href="<%=request.getContextPath()%>/css/font.css">
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/css/xadmin.css">
<script type="text/javascript"
	src="<%=request.getContextPath()%>/lib/layui/layui.js" charset="utf-8"></script>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/js/xadmin.js"></script>
</head>
<body>
	<div class="layui-fluid">
		<div class="layui-row">
			<form class="layui-form" action="">
				<div class="layui-form-item" style="display: none;">
					<label for="id" class="layui-form-label"></span>库存ID</label>
					<div class="layui-input-inline">
						<input type="text" id="id" name="id" required="" readonly="readonly"
							lay-verify="required" autocomplete="off" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item" style="display: none;">
					<label for="goodsId" class="layui-form-label"></span>货物ID</label>
					<div class="layui-input-inline">
						<input type="text" id="goodsId" name="goodsId" required="" readonly="readonly"
							lay-verify="required" autocomplete="off" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label for="goodsName" class="layui-form-label"></span>货物名称</label>
					<div class="layui-input-inline">
						<input type="text" id="goodsName" name="goodsName" required="" readonly="readonly"
							lay-verify="required" autocomplete="off" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item" style="display: none;">
					<label for="respositoryId" class="layui-form-label"></span>仓库ID</label>
					<div class="layui-input-inline">
						<input type="text" id="respositoryId" name="respositoryId" required="" readonly="readonly"
							lay-verify="required" autocomplete="off" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label for="respositoryName" class="layui-form-label"></span>仓库地址</label>
					<div class="layui-input-inline">
						<input type="text" id="respositoryName" name="respositoryName" required="" readonly="readonly"
							lay-verify="required" autocomplete="off" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label for="number" class="layui-form-label"> <span
						class="x-red">*</span>库存数量</label>
					<div class="layui-input-inline">
						<input type="text" id="number" name="number" required=""
							lay-verify="required" autocomplete="off" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label"> </label>
					<button class="layui-btn" lay-filter="add" lay-submit="">
						提交</button>
				</div>
			</form>
		</div>
	</div>
	<script>
		layui.use([ 'jquery', 'form', 'layer' ], function() {
			var $ = layui.jquery;
			var form = layui.form, layer = layui.layer;
			
			//监听提交
			form.on('submit(add)', function(data) {
				// 点击登录按钮
				$.ajax({
					contentType: 'application/json',
					url : '<%=basePath%>storage/updateStorage',
					type : 'POST',
					data : JSON.stringify(data.field),
					async : false,
					dataType : "json",
					success : function(data) {
						if (data.errCode == 200) {
							layer.alert("修改成功", {
								icon : 6
							}, function() {
								//关闭当前frame
								xadmin.close();
								// 可以对父窗口进行刷新 
								xadmin.father_reload();
							});
						} else {
							layer.alert(data.errMsg, {
								icon : 6
							});
						}
					},
					error : function(data) {
						layer.alert(data.errMsg, {
							icon : 6
						});
					}
				});
				return false;
			});
		});
	</script>
</body>
</html>